<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>班级空间</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="css/base.css">
<link rel="stylesheet" href="css/jquery-weui.min.css">
<link rel="stylesheet" href="css/weui.min.css">
<link rel="stylesheet" href="css/index.css">
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/jquery-weui.min.js"></script>
<script src='js/swiper.min.js'></script>
<script src="js/index.js"></script>   
</head>
<body>
<div id="outwrap" style="width: 100%;height: 100%;position: relative;overflow: hidden;">                               
    <div class="setcss">
        <div class="weui-tab">
            <div class="weui-navbar page-top">
                <a class="left" href="classroom_home.html">
                    <img src="images/g_03.png" width="20px" height="20px">
                </a>                   
                <span class="t-title">班级空间</span>  
                <a class="right login">
                    <img src="images/me.png" width="20px" height="20px">
                </a>
            </div>
            <div class="weui-tab__bd page-wrap" >  
                <form action="" id="form">        
                <!-- 班级图像 -->
                <div class="set-item">
                  <span class="item-key">空间头像</span>
                  <div class="imgWrap" style="height:60px;width:60px;border-radius:50%;">
                     <img src="images/wu/t5.png" id="head_img" height="100%">
                  </div>
                  <input type="file" id="file" style="display: none;">
                  <a class="upbotton" dataf = "file">上传</a>
                </div>
                <!-- 班级口号 -->
                <div class="set-item" style="padding-right:15px;">
                  <span class="item-key">班级口号</span>
                  <textarea class="item-input" placeholder="请输入"></textarea>
                </div>
                <!-- 背景图片 -->
                <div class="set-item">
                  <span class="item-key">背景图片</span>
                  <div class="imgWrap">
                     <img src="images/wu/tt_02.jpg" dpoint="center">
                  </div>
                  <input type="file" id="file1" style="display: none;">
                  <a class="upbotton" dataf = "file1">上传</a>
                </div>
                <!-- 轮播图片 -->
                <div class="set-item">
                  <span class="item-key">轮播图片</span>              
                  <a class="upbotton" dataf = "file2">上传</a>   
                </div>
                <div class="bgimgs">
                    <div class="bgimgs-list zhengfang close-re">
                        <a class="close"><img src="images/xx.png" width="100%" height="100%"></a>
                        <img src="images/wu/t5.png" dpoint="center">
                    </div>  
                    <div class="bgimgs-list zhengfang close-re">
                        <a class="close"><img src="images/xx.png" width="100%" height="100%"></a>
                        <img src="images/wu/t5.png" dpoint="center">
                    </div> 
                    <input type="file" id="file2" style="display: none;">
                </div>
                </form> 
                <!-- 底部按钮 -->
                <div class="botm">
                    <a id="saveBtn" class="btn-ok">保 &nbsp; &nbsp; 存</a>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
// 点击选择上传图片
$(".upbotton").click(function(){
   var str = $(this).attr("dataf");
   $("#"+str)[0].click();
})
// 图片上传
$("#file,#file1,#file2").on("change",function(){
    if(this.id !="file2"){
        $(this).parent().find("img").attr("src",$.swFn.getImgurl(this));
    }else{
        $(this).parent().prepend(
            '<div class="bgimgs-list zhengfang close-re">'+
                '<a class="close"><img src="images/xx.png" width="100%" height="100%"></a>'+
                '<img src="'+$.swFn.getImgurl(this)+'" dpoint="center">'+
            '</div>'
        );
        $.swFn.imgCenter($.swFn.fang(".zhengfang").find("img[dpoint=center]"));     
    }
})

// 提交按钮
$("#saveBtn").click(function(){
    $.showLoading();
    $.ajax({
        type:"post",
        url:"",
        data:$("#form").serialize(),
        success:function(data){
            $.hideLoading();
            $.alert("提交成功!","提示"); 


            var da = JSON.parse(data);
            console.log(da);

            
        },
        error:function(er){
            console.log(er);
        },
        timeout:5000                       //超时5秒自动退出，执行ajaxStop
    })
})


</script>
</html>